using System;
using System.Collections.Generic;


namespace Gfw.Models.Admin
{
	[Serializable]
	public partial class UsrUser: IEquatable<UsrUser>
	{

		#region Private Members

		private string _id; 
		private IList<UsrUserfinance> _UsrUserfinanceList; 
		private int _userindex; 
		private string _parentid; 
		private int _parentarea; 
		private string _recommender; 
		private string _code; 
		private int _isactivation; 
		private DateTime? _activationdate; 
		private int _islock; 
		private DateTime? _lockdate; 
		private string _lockreason; 
		private string _loginname; 
		private DateTime? _registrationdate; 
		private string _password; 
		private string _secondpassword; 
		private string _question1; 
		private string _answer1; 
		private string _question2; 
		private string _answer2; 
		private string _question3; 
		private string _answer3; 
		private string _name; 
		private string _tel; 
		private string _address; 
		private string _qq; 
		private string _email; 
		private string _idcard;
        private string _LockType = string.Empty;
        private long _codenumber;
        private string _parentName;
        private string _recommenderName; 		
		#endregion

		#region Constructor

		public UsrUser()
		{
			_id = String.Empty; 
			_UsrUserfinanceList = new List<UsrUserfinance>(); 
			_userindex = 0; 
			_parentid = String.Empty; 
			_parentarea = 0; 
			_recommender = String.Empty; 
			_code = String.Empty; 
			_isactivation = 0; 
			_activationdate = null; 
			_islock = 0; 
			_lockdate = null; 
			_lockreason = String.Empty; 
			_loginname = String.Empty; 
			_registrationdate = null; 
			_password = String.Empty; 
			_secondpassword = String.Empty; 
			_question1 = String.Empty; 
			_answer1 = String.Empty; 
			_question2 = String.Empty; 
			_answer2 = String.Empty; 
			_question3 = String.Empty; 
			_answer3 = String.Empty; 
			_name = String.Empty; 
			_tel = String.Empty; 
			_address = String.Empty; 
			_qq = String.Empty; 
			_email = String.Empty; 
			_idcard = String.Empty; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public UsrUser(
			string id, 
			int userindex)
			: this()
		{
			_id = id;
			_userindex = userindex;
			_parentid = String.Empty;
			_parentarea = 0;
			_recommender = String.Empty;
			_code = String.Empty;
			_isactivation = 0;
			_activationdate = null;
			_islock = 0;
			_lockdate = null;
			_lockreason = String.Empty;
			_loginname = String.Empty;
			_registrationdate = null;
			_password = String.Empty;
			_secondpassword = String.Empty;
			_question1 = String.Empty;
			_answer1 = String.Empty;
			_question2 = String.Empty;
			_answer2 = String.Empty;
			_question3 = String.Empty;
			_answer3 = String.Empty;
			_name = String.Empty;
			_tel = String.Empty;
			_address = String.Empty;
			_qq = String.Empty;
			_email = String.Empty;
			_idcard = String.Empty;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual string Id
		{
			get
			{ 
				return _id;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for Id", value, "null");
				
				if(  value.Length > 40)
					throw new ArgumentOutOfRangeException("Invalid value for Id", value, value.ToString());
				
				_id = value;
			}
		}
			
		public virtual IList<UsrUserfinance> UsrUserfinanceList
		{
			get
			{
				return _UsrUserfinanceList;
			}
			set
			{
				_UsrUserfinanceList = value;
			}
		}

		public virtual int UserIndex
		{
			get
			{ 
				return _userindex;
			}
			set
			{
				_userindex = value;
			}

		}
			
		public virtual string Parentid
		{
			get
			{ 
				return _parentid;
			}

			set	
			{	
				if(  value != null &&  value.Length > 40)
					throw new ArgumentOutOfRangeException("Invalid value for Parentid", value, value.ToString());
				
				_parentid = value;
			}
		}
			
		public virtual int ParentArea
		{
			get
			{ 
				return _parentarea;
			}
			set
			{
				_parentarea = value;
			}

		}
			
		public virtual string Recommender
		{
			get
			{ 
				return _recommender;
			}

			set	
			{	
				if(  value != null &&  value.Length > 40)
					throw new ArgumentOutOfRangeException("Invalid value for Recommender", value, value.ToString());
				
				_recommender = value;
			}
		}

        public virtual string ParentName
        {
            get
            {
                return _parentName;
            }
            set
            {
                if (value != null && value.Length > 40)
                    throw new ArgumentOutOfRangeException("Invalid value for ParentName", value, value.ToString());
                _parentName = value;
            }

        }

        public virtual string RecommenderName
        {
            get
            {
                return _recommenderName;
            }
            set
            {
                if (value != null && value.Length > 40)
                    throw new ArgumentOutOfRangeException("Invalid value for RecommenderName", value, value.ToString());
                _recommenderName = value;
            }

        }

		public virtual string Code
		{
			get
			{ 
				return _code;
			}

			set	
			{	
				if(  value != null &&  value.Length > 100)
					throw new ArgumentOutOfRangeException("Invalid value for Code", value, value.ToString());
				
				_code = value;
			}
		}

        public virtual long CodeNumber
        {
            get
            {
                return _codenumber;
            }
            set
            {
                _codenumber = value;
            }

        }
			
		public virtual int IsActivation
		{
			get
			{ 
				return _isactivation;
			}
			set
			{
				_isactivation = value;
			}

		}
			
		public virtual DateTime? ActivationDate
		{
			get
			{ 
				return _activationdate;
			}
			set
			{
				_activationdate = value;
			}

		}
			
		public virtual int IsLock
		{
			get
			{ 
				return _islock;
			}
			set
			{
				_islock = value;
			}

		}
			
		public virtual DateTime? LockDate
		{
			get
			{ 
				return _lockdate;
			}
			set
			{
				_lockdate = value;
			}

		}
			
		public virtual string LockReason
		{
			get
			{ 
				return _lockreason;
			}

			set	
			{	
				if(  value != null &&  value.Length > 1000)
					throw new ArgumentOutOfRangeException("Invalid value for LockReason", value, value.ToString());
				
				_lockreason = value;
			}
		}
			
		public virtual string LoginName
		{
			get
			{ 
				return _loginname;
			}

			set	
			{	
				if(  value != null &&  value.Length > 60)
					throw new ArgumentOutOfRangeException("Invalid value for LoginName", value, value.ToString());
				
				_loginname = value;
			}
		}
			
		public virtual DateTime? RegistrationDate
		{
			get
			{ 
				return _registrationdate;
			}
			set
			{
				_registrationdate = value;
			}

		}
			
		public virtual string Password
		{
			get
			{ 
				return _password;
			}

			set	
			{	
				if(  value != null &&  value.Length > 128)
					throw new ArgumentOutOfRangeException("Invalid value for Password", value, value.ToString());
				
				_password = value;
			}
		}
			
		public virtual string SecondPassword
		{
			get
			{ 
				return _secondpassword;
			}

			set	
			{	
				if(  value != null &&  value.Length > 128)
					throw new ArgumentOutOfRangeException("Invalid value for SecondPassword", value, value.ToString());
				
				_secondpassword = value;
			}
		}
			
		public virtual string Question1
		{
			get
			{ 
				return _question1;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for Question1", value, value.ToString());
				
				_question1 = value;
			}
		}
			
		public virtual string Answer1
		{
			get
			{ 
				return _answer1;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for Answer1", value, value.ToString());
				
				_answer1 = value;
			}
		}
			
		public virtual string Question2
		{
			get
			{ 
				return _question2;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for Question2", value, value.ToString());
				
				_question2 = value;
			}
		}
			
		public virtual string Answer2
		{
			get
			{ 
				return _answer2;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for Answer2", value, value.ToString());
				
				_answer2 = value;
			}
		}
			
		public virtual string Question3
		{
			get
			{ 
				return _question3;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for Question3", value, value.ToString());
				
				_question3 = value;
			}
		}
			
		public virtual string Answer3
		{
			get
			{ 
				return _answer3;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for Answer3", value, value.ToString());
				
				_answer3 = value;
			}
		}
			
		public virtual string Name
		{
			get
			{ 
				return _name;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for Name", value, value.ToString());
				
				_name = value;
			}
		}
			
		public virtual string Tel
		{
			get
			{ 
				return _tel;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for Tel", value, value.ToString());
				
				_tel = value;
			}
		}
			
		public virtual string Address
		{
			get
			{ 
				return _address;
			}

			set	
			{	
				if(  value != null &&  value.Length > 256)
					throw new ArgumentOutOfRangeException("Invalid value for Address", value, value.ToString());
				
				_address = value;
			}
		}
			
		public virtual string Qq
		{
			get
			{ 
				return _qq;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for Qq", value, value.ToString());
				
				_qq = value;
			}
		}
			
		public virtual string Email
		{
			get
			{ 
				return _email;
			}

			set	
			{	
				if(  value != null &&  value.Length > 256)
					throw new ArgumentOutOfRangeException("Invalid value for Email", value, value.ToString());
				
				_email = value;
			}
		}
			
		public virtual string IdCard
		{
			get
			{ 
				return _idcard;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for IdCard", value, value.ToString());
				
				_idcard = value;
			}
		}

        public virtual string LockType
        {
            get
            {
                return _LockType;
            }
            set{
                if (value != null && value.Length > 50)
                    throw new ArgumentOutOfRangeException("Invalid value for LockType", value, value.ToString());

                _LockType = value;
            }
        }
				
		#endregion 

		#region Public Functions

		public virtual void AddUsrUserfinance(UsrUserfinance obj)
		{
			#region Check if null
			if (obj == null)
				throw new ArgumentNullException("obj", "El parametro no puede ser nulo");
			#endregion
			_UsrUserfinanceList.Add(obj);
		}
		

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			UsrUser castObj = (UsrUser)obj; 
			return ( castObj != null ) &&
				( this._id == castObj.Id );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _id.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public virtual bool Equals(UsrUser other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._id == other.Id );
				   
		}

		#endregion
		
	}
}
